import { Form, FormInstance, Input } from 'antd'
import './index.less'
export default function QsfLogin(props: { form: FormInstance }) {
  const onValuesChange = (changedValues: any) => {
    const trimKeys = ['workId', 'password']
    trimKeys.forEach((key) => {
      if (changedValues[key]) {
        const trimmedKey = changedValues[key].trim()
        props.form.setFieldsValue({
          [key]: trimmedKey,
        })
      }
    })
  }
  return (
    <div className="qsf_login_page">
      <Form form={props.form} onValuesChange={onValuesChange}>
        <Form.Item name="workId" rules={[{ required: true, message: '请输入工号' }]}>
          <Input placeholder="请输入工号" />
        </Form.Item>
        <Form.Item name="password" rules={[{ required: true, message: '请输入密码' }]}>
          <Input.Password placeholder="请输入密码" />
        </Form.Item>
      </Form>
    </div>
  )
}
